package ar.com.vates.ejercicio2;

public class Contenedor {

	private int buffer = 0;
	
	public synchronized void setear(){
		if(buffer == 0){
			try {
				wait();
			} catch (InterruptedException e) {

				e.printStackTrace();
			}
		}
		buffer = 0;
		System.out.println(buffer);
		notifyAll();
	}

	public synchronized void editar(int numero) {
		if(buffer != 0){
			try {
				wait();
			} catch (InterruptedException e) {
			
				e.printStackTrace();
			}
		}
		buffer = numero;
		System.out.println(buffer);
		notifyAll();
	}

	public int mostrar() {
		return buffer;
	}
	
}
